package cn.edu.nwpu.manager.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
/**
 * @author Hutengzhong
 * @version 1.0.0
 * @title Dormitory 宿舍表
 * @description TODO
 * @date 2023/9/16
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Dormitory {
    private Integer id;
    private String dormitoryName;
    private String address;
    private Integer isDeleted;
    public Dormitory(HashMap parameters) {
        // parameters={address=C8, dormitoryName=1103}
        if (parameters == null){
            return;
        }else {
            try {
                if (parameters.containsKey("id")){
                    id = Integer.parseInt((String) parameters.get("id"));
                }
                if (parameters.containsKey("address")){
                    address = (String) parameters.get("address");
                }
                if (parameters.containsKey("dormitoryName")){
                    dormitoryName = (String) parameters.get("dormitoryName");
                }
            }catch (Exception e){
                System.out.println("前端传递参数转化异常: 参考类型异常");
            }
        }
    }
}
